package com.softline.documentsmall.controller;

import com.softline.documentsmall.entity.ZsIndexInformation;
import com.softline.documentsmall.ret.ReturnVO;
import com.softline.documentsmall.service.ZsIndexInformationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: documentsmall
 * @description:
 * @author: zwc
 * @create: 2021-03-16
 */

@Api(value="指数资讯控制器",tags={"指数资讯控制器"})
@RestController
@RequestMapping("/zsIndexInfo")
@CrossOrigin(allowCredentials = "true",allowedHeaders = "*")
public class ZsIndexInformationController {

    @Autowired
    ZsIndexInformationService zsIndexInformationService;

    @ApiOperation(value="指数资讯--列表", notes = "指数资讯--列表")
    @GetMapping(value = "/list")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "languageType", value = "语言类型 en:英文，cn中文，默认中文")
    })
    public ReturnVO list(@RequestParam(value = "languageType",defaultValue = "cn")String languageType){
        return zsIndexInformationService.findZsIndexInfo(languageType);
    }


    @ApiOperation(value="指数资讯--详情页(根据Id)", notes = "指数资讯--详情页(根据Id)")
    @GetMapping(value = "/getById")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "languageType", value = "语言类型 en:英文，cn中文，默认中文"),
            @ApiImplicitParam(name = "id", value = "资讯id")
    })
    public ReturnVO getById(@RequestParam(value = "id") Integer id,@RequestParam(value = "languageType",defaultValue = "cn")String languageType){
        return zsIndexInformationService.getById(id,languageType);
    }
    @ApiOperation(value="指数资讯--新增", notes = "指数资讯--新增")
    @PostMapping(value = "/insert")
    public ReturnVO insert(ZsIndexInformation zsIndexInformation){

        return zsIndexInformationService.insertZsIndexInfo(zsIndexInformation);

    }

    @ApiOperation(value="指数资讯--根据id删除", notes = "指数资讯--根据id删除")
    @DeleteMapping(value = "/deleteById")
    public ReturnVO deleteById(Integer id){
        return zsIndexInformationService.deleteZsIndexInfoById(id);
    }


    @ApiOperation(value="指数资讯--更新", notes = "指数资讯--更新")
    @PutMapping(value = "/update")
    public ReturnVO update(ZsIndexInformation zsIndexInformation){

        return zsIndexInformationService.updateZsIndexInfo(zsIndexInformation);
    }



    @ApiOperation(value="指数详情页--更多资讯", notes = "指数详情页--更多资讯")
    @GetMapping(value = "/detailMore")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "languageType", value = "语言类型 en:英文，cn中文，默认中文")
    })
    public ReturnVO detailMore(@RequestParam(value = "languageType",defaultValue = "cn")String languageType){
        return zsIndexInformationService.getMoreDetail(languageType);
    }





}
